import request from '@/utils/request'
import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

// 查询地区
export function pageList(data) {
    return request({
      url: '/exam/list/pageList',
      method: 'post',
      data
    })
}

// 编辑考试配置
export function editExam(data) {
    return request({
      url: '/exam/list/edit',
      method: 'post',
      data
    })
  }
  
  // 删除考试配置
  export function deleteExam(data) {
    return request({
      url: '/exam/list/delete',
      method: 'post',
      data
    })
  }

  // 考试成绩录入
  export function addExamResult(data) {
    return request({
      url: '/exam/list/addExamResult',
      method: 'post',
      data
    })
  }

  // 考试成绩录入
  export function updateExamResult(data) {
    return request({
      url: '/exam/list/updateExamResult',
      method: 'post',
      data
    })
  }

  // 考试成绩导出
  export function toExcel(data) {
    return request({
      url: '/exam/list/export',
      method: 'post',
      responseType: 'blob',
      data
    })
  }

  // 考试成绩导入
  export function importExcel(data) {
    return request({
      url: '/exam/list/import',
      method: 'post',
      headers: {
        'Authorization': 'Bearer ' + Cookies.get(TokenKey),
      },
      data
    })
  }

  // 考试成绩查询
  export function searchResult(examId) {
    return request({
      url: '/exam/list/searchResult/'+examId,
      method: 'get',
    })
  }